package com.crlui.component
{
	import com.crlui.component.itemRender.ListItemRender;
	import com.crlui.core.ILayoutable;
	
	import flash.display.DisplayObject;
	
	/**
	 * 
	 * @author crl
	 * 
	 */	
	public class TileLayout implements ILayoutable
	{
		private var width:int;
		private var height:int;
		private var col:int;
		public function TileLayout(width:int,height:int,col:int)
		{
			this.width=width;
			this.height=height;
			this.col=col;
		}
		
		public function layout(list:Vector.<ListItemRender>):void
		{
			var nextX:int;
			var nextY:int;
			var len:int=list.length;
			
			var display:DisplayObject;
			for(var i:int=0;i<len;i++){
				display=list[i];
				
				display.x=(i%col)*width;
				display.y=(i/col)*height;
			
			}
			
		}
	}
}